﻿namespace ConsoleApp7
{
     class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入一行字符：");
            string input = Console.ReadLine();

            if (string.IsNullOrEmpty(input))
            {
                Console.WriteLine("输入为空，请重新运行程序并输入字符。");
                return;
            }
            int letterCount = 0;
            int spaceCount = 0;
            int digitCount = 0;
            int otherCount = 0;
            foreach (char c in input)
            {
                if (char.IsLetter(c))
                {
                    letterCount++;
                }
                else if (char.IsWhiteSpace(c))
                {
                    spaceCount++;
                }
                else if (char.IsDigit(c))
                {
                    digitCount++;
                }
                else
                {
                    otherCount++;
                }
            }

            Console.WriteLine("\n统计结果：");
            Console.WriteLine($"英文字母个数: {letterCount}");
            Console.WriteLine($"空格个数: {spaceCount}");
            Console.WriteLine($"数字个数: {digitCount}");
            Console.WriteLine($"其他字符个数: {otherCount}");
        }
    }
}
